package com.atguigu.day08.p4;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/8 14:34
 * @注释
 */
public class Rectangle {
    private int length;
    private int wide;
    public void setWeight(int length) {
        if (length < 0) {
            System.out.println("你输入的格式有误");
        }else{
            this.length = length;
        }
    }
    public void setWide(int wide) {
        if (wide < 0) {
            System.out.println("你输入的格式有误");
        }else{
            this.wide = wide;
        }
    }
    public int getLength() {
        return length;
    }
    public int getWide() {
        return wide;
    }
    public double area() {
        return length * wide;
    }
    public double perimeter() {
        return ((length * 2) + (wide * 2));
    }
    public String getInfo(){
        return "长: " + getLength() + ", 宽:" + getWide() + ", 面积:" + area() + ", 周长:" + perimeter();
    }
}
